package com.bee.common.core.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
/**
 * 数据字段权限级别
 * order by sort asc
 */
public enum PermissionLevelEnum {

    Internal("Internal","基础字段可见",5),
    Summary("Summary","统计字段可见",4),
    Group("Group","组字段可见",3),
    Private("Private","私有字段可见",2),
    Public("Public","全部字段可见",1);

    private String code;
    private String name;
    private int sort;

    PermissionLevelEnum(String code, String name,int sort) {
        this.code = code;
        this.name = name;
        this.sort = sort;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static int getSortByCode(String value) {
        for (PermissionLevelEnum itemEnum : PermissionLevelEnum.values()) {
            if (itemEnum.code.equals(value)) {
                return itemEnum.sort;
            }
        }
        return 100;
    }


}
